<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <p>count: {{ count }}</p>
      <!-- <button v-on:click="count++">btn</button> -->
      <button @click="add(2)">btn</button>

      <!-- oninput方法是在内容改变的时候触发 -->
      <!-- onchange方法是在内容改变并且失去焦点的时候触发 -->
      <input type="text" @input="handleChange(3, $event)" />
    </div>

    <script src="./Vue3.js"></script>
    <script>
      const { createApp } = Vue;

      createApp({
        data() {
          return {
            count: 1,
          };
        },
        methods: {
          add(num) {
            this.count += num;
          },
          handleChange(num, e) {
            console.log(num);
            // console.log("input内容改变了");
            console.log(e.target.value);
          },
        },
      }).mount("#app");
    </script>
  </body>
</html>
